<?php

namespace app\model;

use think\facade\Db;
use think\Model;

class AboutUsModel extends Model {

    protected $table ="about_us";

    protected $pk = 'about_us_id';

    private $cacheKey="about:us:id:";

    private $cacheTime=5184000;




    /*
   * 获取订单状态详情
   * */
    public function getInfo($id){
        $cacheKey = $this->cacheKey.$id;
        $redisModel = new RedisModel();
        $info = $redisModel->get($cacheKey);
        if($info){
            return json_decode($info,true);
        }

        $info = Db::name('about_us')->find($id);

        if($info){
            $redisModel->set($cacheKey,json_encode($info,256),$this->cacheTime);
            return $info;
        }
        return $info;
    }



    /*
 * 更新条件更新订单
 * */
    public function updateAll($where,$data){
        return Db::name('about_us')->where($where)->update($data);
    }



}